/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hudson.msservice.message_entry;

import hudson.msservice.Messages;

/**
 *
 * @author janksenhu
 */
public class MessageUtil {

     /**
     * return chinese of SUCCESS,ABORT,FAILTRUE
     */
    public static String getChineseOfResult(String result) {
        if (result!=null && result.equals("SUCCESS")) {
            return Messages.Result_SUCCESS();
        } else if (result!=null && result.equals("FAILURE")) {
            return Messages.Result_FAILURE();
        } else if (result!=null && result.equals("ABORTED")) {
            return Messages.Result_ABORTED();
        } else if (result!=null && result.equals("not_execute_steps")) {
            return Messages.Result_NotSchedule();
        } else {
            return Messages.Result_NoResult();
        }
    }
    
    /**
     * we filter some user like  
     *  timer,SYSTEM,test #102,anonymous
     */
    public static boolean isTencentDomainUser(String username){
        String [] tem={"timer","SYSTEM","anonymous"};
        for(String str:tem){            
            if(username.equals(str)){
                return false;
            }else if(username.indexOf("#")>-1){
                return false;
            }
        }
        return true;
    }
}
